package com.example.houqin_oa.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.comment_oa.pojos.rear.Entrepot;
import com.example.comment_oa.pojos.rear.Noet;
import com.example.houqin_oa.mapper.EntrepotMapper;
import com.example.houqin_oa.mapper.PublicWareMapper;
import com.example.houqin_oa.service.NoetService;
import com.example.houqin_oa.mapper.NoetMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author liang
* @description 针对表【noet】的数据库操作Service实现
* @createDate 2022-11-06 21:04:37
*/
@Service
public class NoetServiceImpl extends ServiceImpl<NoetMapper, Noet>
    implements NoetService{

    @Autowired
    NoetMapper noetMapper;

    @Autowired
    PublicWareMapper publicWareMapper;

    @Autowired
    EntrepotMapper entrepotMapper;

    @Override
    public Boolean AddInventory(Noet noet) {
        int Inventory = noetMapper.insert(noet);

        boolean Count = publicWareMapper.Rework(noet);
        if(Inventory == 1 && Count){
            return true;
        } else {
            return false;
        }
    }
    //盘点公共查询
    @Override
    public List<Noet> AllInventory(Noet noet) {
        return noetMapper.AllInventory(noet);
    }

    @Override
    public Boolean AddLookUp(Noet noet) {
        int LookUp = noetMapper.insert(noet);
        boolean Count = entrepotMapper.Rework(noet);
        if(LookUp == 1 && Count){
            return true;
        } else {
            return false;
        }
    }
}




